home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byt86oct.arc / ALLOC.ARC / MACHINES.DEF < prev    next >
Text File  |  1985-07-12  |  1KB  |  43 lines

  1. DEFINITION MODULE MachineSpecific;
  2.  
  3. (* These routines are specific to the computer being used to run the program.
  4.    Most of the problems on the Mac stem from the facts that the unit of
  5.    addressing is the byte, not the word, and that an address is 32 bits while
  6.    a word is only 16.
  7. *)
  8.  
  9. FROM SYSTEM IMPORT WORD, ADDRESS;
  10.  
  11. EXPORT QUALIFIED getHeapBottom, getHeapTop, bytesPerWord, address, cardinal,
  12.     addrLessThan, writeAddress, addWords, subtractWords, maxAddress;
  13.  
  14. CONST bytesPerWord  = 2;
  15.  
  16. VAR maxAddress:ADDRESS;   (* largest address on the machine *)
  17.  
  18. PROCEDURE getHeapBottom():ADDRESS;
  19. (* Returns address of lowest byte in heap *)
  20.  
  21. PROCEDURE getHeapTop():ADDRESS;
  22. (* Returns address of highest byte in heap *)
  23.  
  24. PROCEDURE address(w:WORD):ADDRESS;
  25. (* converts a word (16 bits on a Mac) into an address (32 bits) *)
  26.  
  27. PROCEDURE cardinal(a:ADDRESS):CARDINAL;
  28. (* converts the low-order 16 bits of an address (on a Mac) to a cardinal *)
  29.  
  30. PROCEDURE addrLessThan(a1, a2:ADDRESS):BOOLEAN;
  31. (* Returns true if a1 is less than a2 *)
  32.  
  33. PROCEDURE writeAddress(a:ADDRESS);
  34. (* writes the address in hex *)
  35.  
  36. PROCEDURE addWords(a:ADDRESS; nWords:CARDINAL):ADDRESS;
  37. (* adds nWords Modula-2 words to the address *)
  38.  
  39. PROCEDURE subtractWords(a:ADDRESS; nWords:CARDINAL):ADDRESS;
  40. (* subtracts nWords Modula-2 words from the address *)
  41.  
  42. END MachineSpecific.
  43. actWords(a:ADDRESS; nW